using B.S.NewMedical.Api.Write.Application.Command.MobileService.Consult;
using B.S.NewMedical.ErrorCode;
using MediatR;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;

namespace B.S.NewMedical.Api.Write.Controllers.Order
{
    [Route("api/[controller]")]
    [ApiController]
    public class ConsultController : ControllerBase
    {
        private readonly IMediator _mediator;

        public ConsultController(IMediator mediator)
        {
            _mediator = mediator;
        }

        /// <summary>
        /// 创建用户互动（点赞/收藏/追问）
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="objType">对象类型(question/answer)</param>
        /// <param name="objId">对象ID</param>
        /// <param name="action">操作类型(like/fav/follow)</param>
        /// <returns>操作结果</returns>
        [HttpPost("interact")]
        public async Task<ApiResult<bool>> CreateInteract(
            [FromQuery] int userId,
            [FromQuery] string objType,
            [FromQuery] int objId,
            [FromQuery] string action)
        {
            return await _mediator.Send(new CreateConsultInteractCommand(userId, objType, objId, action));
        }
    }
}